

**** Appendix SPATIAL ANALYSIS
**** Robustness, mediation with spatially correlated errors

clear all

** cd ... to file directory
*** use " ... domenechsanchezcuenca_provincial.dta"

cd "/... domenechsanchezcuenca_BJPS"

use ".... domenechsanchezcuenca_BJPS/domenechsanchezcuenca_province_reg.dta"

drop _ID
drop _merge

*** transform the shape file for stata use

spshape2dta Provincias_ETRS89_30N.shp, replace

**** changes in provincial ID so that shape file and stata file match

gen _id=0

replace _id=1 if provid==2

replace _id=2 if provid==3

replace _id=3 if provid==4

replace _id=4 if provid==5

replace _id=5 if provid==7

replace _id=6 if provid==8

replace _id=7 if provid==9

replace _id=8 if provid==10

replace _id=9 if provid==11

replace _id=10 if provid==12

replace _id=11 if provid==13

replace _id=12 if provid==15

replace _id=13 if provid==16

replace _id=14 if provid==17

replace _id=15 if provid==1

replace _id=16 if provid==18

replace _id=17 if provid==19

replace _id=18 if provid==21

replace _id=19 if provid==22

replace _id=20 if provid==23

replace _id=21 if provid==24

replace _id=22 if provid==25

replace _id=23 if provid==26

replace _id=24 if provid==28

replace _id=25 if provid==29

replace _id=26 if provid==27

replace _id=27 if provid==30

replace _id=28 if provid==31

replace _id=29 if provid==32

replace _id=30 if provid==33

replace _id=31 if provid==34

replace _id=32 if provid==35

replace _id=33 if provid==6

replace _id=34 if provid==36

replace _id=35 if provid==20

replace _id=36 if provid==37

replace _id=37 if provid==38

replace _id=38 if provid==43

replace _id=39 if provid==14

replace _id=40 if provid==39

replace _id=41 if provid==40

replace _id=42 if provid==41

replace _id=43 if provid==42

replace _id=44 if provid==44

replace _id=45 if provid==45

replace _id=46 if provid==46

replace _id=47 if provid==47 

replace _id=48 if provid==48

replace _id=49 if provid==49

replace _id=50 if provid==50


replace leftrepression=0 if leftrepression==.

gen asin_leftrepression=asinh(leftrepression)

gen asin_rightrepression=asinh(rightrepression)

gen leftrepression_pop=leftrepression/pop1930

gen rightrepression_pop=rightrepression/pop1930

gen PopularFront_Right=PopularFront*asin_rightrepression

gen PopularFront_Left=PopularFront*asin_leftrepression



rename _id _ID

xtset _ID year

spbalance

*** We merge database with the shapefile

merge m:1 _ID using Provincias_ETRS89_30N

keep if _merge==3

drop _merge



save table_SPATIAL_appendix.dta, replace

spset





*** We create the matrix of spatial weights

**spmatrix create contiguity W if year==1977, first second(0.5)

spmatrix create contiguity W if year==1977



**** Table J1

****** column (1) 
spxtregress LEFTvotosinreg lanineq_1860   histregion   ib1977.year altitud _CX _CY, re errorlag(W) 

****** column (2)
spxtregress LEFTvotosinreg c.lanineq_1860  PopularFront  asin_rightrepression histregion   ib1977.year, re errorlag(W) 

****** column (3)

spxtregress LEFTvotosinreg c.lanineq_1860  Unemp Industry   Education histregion   ib1977.year, re errorlag(W) 

****** Column (4)
spxtregress LEFTvotosinreg lanineq_1860   histregion   ib1977.year, re dvarlag(W) errorlag(W) 

***** Column (5)

spxtregress LEFTvotosinreg c.lanineq_1860  PopularFront asin_rightrepression histregion   ib1977.year, re dvarlag(W) errorlag(W) 

***** Column (6)

spxtregress LEFTvotosinreg c.lanineq_1860  Unemp Industry   Education histregion   ib1977.year, re dvarlag(W) errorlag(W) 



***** Table J2

******* column (1)

spxtregress LEFTvotosinreg lanineq_1920   histregion   ib1977.year, re errorlag(W) 

****** Column (2)

spxtregress LEFTvotosinreg c.lanineq_1920  PopularFront  asin_rightrepression   histregion   ib1977.year, re errorlag(W) 

****** Column (3)

spxtregress LEFTvotosinreg c.lanineq_1920  Unemp  Industry  Education histregion   ib1977.year, re errorlag(W) 


***** Column (4)


spxtregress LEFTvotosinreg lanineq_1920   histregion   ib1977.year, re dvarlag(W) errorlag(W) 

***** Column (5)

spxtregress LEFTvotosinreg c.lanineq_1920  PopularFront  asin_rightrepression histregion   ib1977.year, re dvarlag(W) errorlag(W) 

***** Column (6)

spxtregress LEFTvotosinreg c.lanineq_1920  Unemp  Industry  Education histregion   ib1977.year, re dvarlag(W) errorlag(W) 
